<template>
  <el-dialog :visible="showDialog" top="2vh" @close="handleClose">
    <template #title>
      <h2 style="text-align: center">
        😏🥶🤬🤢🥸👿👻👽👾🤖💩😾🙈🦓🐴🦄🐔🌭🍟🥨🥯🥖🧑‍🎄🎅
      </h2>
      <h2 style="text-align: center">题目审核</h2>
    </template>
    <el-form>
      <el-form-item label="审核意见" width="80px">
        <el-radio-group v-model="subjectData.chkState">
          <el-radio :label="1"> 通过 </el-radio>
          <el-radio :label="2"> 拒绝 </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="审核概述" width="80px">
        <el-input v-model="subjectData.chkRemarks" style="width: 80%" />
      </el-form-item>
    </el-form>

    <template #footer>
      <el-button type="primary" @click="resetQuestionCheck">提交审核</el-button>
    </template>
  </el-dialog>
</template>

<script>
import { resetQuestionCheckAPI } from '@/api/basic'
export default {
  name: 'ResetCom',
  props: {
    showDialog: {
      type: Boolean,
      default: false
    },
    subjectData: {
      type: Object,
      required: true
    }
  },
  created() {
    console.log('学科详情', this.subjectData)
  },
  methods: {
    // 试题审核
    async resetQuestionCheck() {
      // const resp =
      await resetQuestionCheckAPI(this.subjectData)
      // console.log('1', resp)
      if (this.subjectData.chkState === 1) {
        await this.$message.success('审核通过')
      } else {
        await this.$message.warning('不通过，审核原因已反馈至后台')
      }
      this.handleClose()
    },
    // 关闭弹窗
    handleClose() {
      this.$emit('add-success')
      this.$emit('closeDialog')
    }
  }
}
</script>

<style>
</style>
